using UnityEngine;
namespace Framework.Utils
{
    public class PlayerPrefsEx
    {
        public static void SetBool(string key, bool value)
        {
            if (value)
            {
                PlayerPrefs.SetInt(key, 1);
            }
            else
            {
                PlayerPrefs.SetInt(key, 0);
            }
        }

        public static bool GetBool(string key,bool defaultValue)
        {
            int dv = defaultValue ?1:0;
            int value = PlayerPrefs.GetInt(key, dv);
            if (value == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 默认返回false
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static bool GetBool(string key)
        {
            return GetBool(key, false);
        }
    }

}